<script setup>
import { provide, ref } from 'vue';
import Son from './components/Son.vue';
import Grandson from './components/Grandson.vue';

const money = ref(10000)
const add = (val) => {
  money.value += val
}

const car = ref('兰博基尼')
// 祖先组件 provide 提供数据，语法跟 localStorage 非常相似
// localStorage.setItem('todos', 'todos')
provide('money', money)
provide('add', add)
provide('car', car)
</script>

<template>
  <h1>父组件</h1>
  <Son></Son>
</template>
